package com.itheima.controller;


//import com.itheima.config.UserConfig;
import com.itheima.config.UserConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;




@RestController
@Slf4j //添加此注解后，就可以在类中使用一个log对象了
public class IndexController {

//  @Value("${user.username}")
//  private String username;

//  @Value("${user.password}")
//  private String password;

  @Autowired
  private UserConfig username;


  @GetMapping("/index")
    public String index() {
    System.out.println(username);
    log.debug("AAA");
    log.info("BBB");
    log.warn("CCC");
    log.error("DDD");
    return "hello,spring-boot";
  }

  //读取配置
  @GetMapping("/log")
  public String log() {
    log.debug("AAA");
    log.info("BBB");
    log.warn("CCC");
    log.error("DDD");
    return "hello,springboot2!";

  }

}
